package org.apache.jsp.view.comprar.efetuadas;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import br.com.skpharma.vo.*;
import br.com.skpharma.dao.*;
import java.util.*;

public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=iso-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<head>\r\n");


	if (session.getAttribute("usuarioLogado") == null){
		
      out.write("\r\n");
      out.write("\t\t<script language=\"javascript\">\r\n");
      out.write("\t\t\talert(\"Faça seu login ou cadastre-se!\");\r\n");
      out.write("\t\t\twindow.location.href=\"index.jsp?menu=home\";\r\n");
      out.write("\t\t</script>\r\n");
      out.write("\t");
	
	}
	else {
		int codcliente = ((ClienteVO)session.getAttribute("usuarioLogado")).getCod();
	

      out.write("\r\n");
      out.write("\r\n");
      out.write("<script language=\"JavaScript\">\r\n");
      out.write("function buscaMarca(valor)\r\n");
      out.write("{\r\n");
      out.write(" \twindow.location.href=\"index.jsp?mar=\" + valor.value;\r\n");
      out.write("}\r\n");
      out.write("function buscaPrin(valor)\r\n");
      out.write("{\r\n");
      out.write(" \twindow.location.href=\"index.jsp?prin=\" + valor.value;\r\n");
      out.write("}\r\n");
      out.write("</script>\r\n");
      out.write(" \r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<link href=\"../../css/css.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write("body {\r\n");
      out.write("\tmargin-left: 0px;\r\n");
      out.write("\tmargin-top: 0px;\r\n");
      out.write("\tmargin-right: 0px;\r\n");
      out.write("\tmargin-bottom: 0px;\r\n");
      out.write("}\r\n");
      out.write("a:link {\r\n");
      out.write("\tcolor: #000000;\r\n");
      out.write("\ttext-decoration: none;\r\n");
      out.write("}\r\n");
      out.write("a:visited {\r\n");
      out.write("\ttext-decoration: none;\r\n");
      out.write("\tcolor: #000000;\r\n");
      out.write("}\r\n");
      out.write("a:hover {\r\n");
      out.write("\ttext-decoration: none;\r\n");
      out.write("\tcolor: #999999;\r\n");
      out.write("}\r\n");
      out.write("a:active {\r\n");
      out.write("\ttext-decoration: none;\r\n");
      out.write("\tcolor: #000000;\r\n");
      out.write("}\r\n");
      out.write(".style1 {color: #FFFFFF}\r\n");
      out.write(".style2 {color: #000000}\r\n");
      out.write("-->\r\n");
      out.write("</style></head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<form method=\"POST\" action=\"index.jsp\" >\r\n");
      out.write("  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td valign=\"top\"><table width=\"700\" border=\"0\" align=\"left\" cellpadding=\"5\" cellspacing=\"2\" bordercolor=\"#f2f2f2\" style=\"font-size:12px\">\r\n");
      out.write("        <tr>\r\n");
      out.write("          <td width=\"38%\" bgcolor=\"#941C1D\" class=\"style1\"><p class=\"style3 style1\"><strong>C&oacute;digo</strong></p></td>\r\n");
      out.write("          <td width=\"20%\" bgcolor=\"#941C1D\" class=\"style1\"><p class=\"style3 style1\"><strong>Data</strong></p></td>\r\n");
      out.write("          <td width=\"20%\" bgcolor=\"#941C1D\" class=\"style1\"><p class=\"style3 style1\"><strong>Valor Total </strong></p></td>\r\n");
      out.write("          <td width=\"20%\" bgcolor=\"#941C1D\" class=\"style1\"><p class=\"style3 style1\"><strong>Status</strong></p></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("        ");

//if (request.getParameter("prin") != null){
	//int codigo = Integer.valueOf(request.getParameter("prin"));
		DAOVenda daoVenda = new DAOVenda ();
		ArrayList lista = new ArrayList();
		
		lista = daoVenda.obterListaPorCliente(codcliente);
				for (int i = 0; i<lista.size(); i++){
		
	
		
      out.write("\r\n");
      out.write("        <tr>\r\n");
      out.write("          <td width=\"38%\" class=\"style1\"><a href=\"#\" onclick=\"window.open('view/comprar/efetuadas/detalhe.jsp?venda=");
      out.print(((VendaVO)lista.get(i)).getCod());
      out.write("', 'Pagina', 'STATUS=NO, TOOLBAR=NO, LOCATION=NO, DIRECTORIES=NO, RESISABLE=NO, SCROLLBARS=YES, TOP=10, LEFT=10, WIDTH=770, HEIGHT=500');\">");
      out.print(((VendaVO)lista.get(i)).getCod());
      out.write("</a> </td>\r\n");
      out.write("          <td width=\"20%\" class=\" style1\"><span class=\"style4 style2\">");
      out.print(((VendaVO)lista.get(i)).getHorarioEntrega());
      out.write("</span></td>\r\n");
      out.write("          <td width=\"20%\" class=\" style1\"><span class=\"style4 style2\">");
      out.print(((VendaVO)lista.get(i)).getValorTotal());
      out.write("</span></td>\r\n");
      out.write("          <td width=\"20%\" class=\" style1\"><span class=\"style4 style2\">");
      out.print(((VendaVO)lista.get(i)).getStatusVO().getDs());
      out.write("</span></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("        ");
	
				
		}
		
	
}
      out.write("\r\n");
      out.write("      </table></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td><p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p>\r\n");
      out.write("      <p>&nbsp;</p></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("  </form>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
